package org.example.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author tds
 * @version 1.0.0
 * @Company
 * @ClassName OrderController
 * @Description TODO（这里用一句话描述这个类的作用)
 * @Date 2023-04-12 21:46
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/add")
    public String add() {
        String res = restTemplate.getForObject("http://stock/stock/deduct", String.class);
        return res;
    }

    @RequestMapping("/test1")
    public String test1() {
        return "test1";
    }
    @RequestMapping("/test2")
    public String test2() {
        String res = restTemplate.getForObject("http://order/order/test1", String.class);
        return res;
    }
}
